#include "progress.h"

const char style[S_NUM] = {'#','>','*','-','='};

const char circle[4] = {'-','\\','|', '/'};

void Progress_Bar()
{
    char bar[NUM+1] = {'\0'};
    memset(bar,style[N],sizeof(bar)-1); // 最后一位留一个'\0' // N在makefile中给出（宏定义在编译时给）

    int i = NUM;
    while(i>=0)
    {
        printf("\033[46;37m[%-100s][%d%%][%c]\r\033[0m",bar+i,NUM-i,circle[(NUM-i)%4]);
        fflush(stdout);

        usleep(50000);
        --i;
    }

    printf("\n");
}

